﻿package com.wandian.view.components.ui.bank
{
	import com.wandian.ApplicationFacade;
	import com.wandian.controller.CLZNoticeName;
	import com.wandian.data.GameData;
	import com.wandian.util.CLZButton;
	import com.wandian.util.CLZListPage;
	import com.wandian.util.CLZListPageGetPage;
	import com.wandian.util.CLZTxtTip;
	import com.wandian.util.TextControl;
	import com.wandian.view.components.ui.AddBtn;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;

    public class RecordBankPanel extends Object
    {
        private var _arrList:Array;
        private var _mcPanel:Sprite;
        private var _global:GameData;
        private var _facade:ApplicationFacade;
        private var _listPage:CLZListPageGetPage;

        public function RecordBankPanel()
        {
            this._global = GameData.getInstance();
            this._facade = ApplicationFacade.getInstance();
            return;
        }

        public function setPanel(param1:Sprite) : void
        {
            this._mcPanel = param1;
            this._mcPanel["numberIdName_txt"].text = GameData.tip["NUMBER_NAME"];
            this._mcPanel["recordName_txt"].text = GameData.tip["RECORDNAME"];
            this._mcPanel["goldName_txt"].text = GameData.tip["BANK_GOLDNAME"];
            this._mcPanel["timeName_txt"].text = GameData.tip["TIME_NAME"];
            this._arrList = [this._mcPanel["info1"], this._mcPanel["info2"], this._mcPanel["info3"], this._mcPanel["info4"], this._mcPanel["info5"], this._mcPanel["info6"], this._mcPanel["info7"], this._mcPanel["info8"], this._mcPanel["info9"], this._mcPanel["info10"]];
            CLZButton.setButton(this._mcPanel["prev_btn"], GameData.tip["PREV_PAGE"]);
            CLZButton.setButton(this._mcPanel["next_btn"], GameData.tip["NEXT_PAGE"]);
            CLZButton.setButton(this._mcPanel["go_btn"], "GO");
            var _loc_2:int = 0;
            while (_loc_2 < this._arrList.length)
            {
                
                this._arrList[_loc_2].addEventListener(CLZListPage.UPDATE_DATA, this.updateInfoDataHandler);
                _loc_2 = _loc_2 + 1;
            }
            this._listPage = new CLZListPageGetPage(this._arrList, this._mcPanel["prev_btn"], this._mcPanel["next_btn"], this._mcPanel["_txtPaging"], this._mcPanel["_txtInput"], this._mcPanel["go_btn"], this.gotoPageFun);
            this.gotoPageFun(1);
            return;
        }

        public function showRecordList(param1:Object) : void
        {
            this._listPage.setInfoPage(param1.arr, param1.page, param1.all);
            return;
        }

        private function gotoPageFun(param1:int) : void
        {
            this._facade.sendNotification(CLZNoticeName.BANK_COMMIT_RECORD_REQ, param1);
            return;
        }

        private function updateInfoDataHandler(event:Event) : void
        {
            var _loc_4:String = null;
            var _loc_2:* = event.target as MovieClip;
            var _loc_3:* = String(_loc_2.info).split(",");
            trace(_loc_3, "|" + _loc_3.length, "|" + _loc_2.info);
            switch(int(_loc_3[0]))
            {
                case 0:
                {
                    _loc_4 = GameData.tip["DEPOSIT_NAME"];
                    break;
                }
                case 1:
                {
                    _loc_4 = GameData.tip["WITHDRAW_NAME"];
                    break;
                }
                case 2:
                {
                    _loc_4 = GameData.replaceStrValue(GameData.replaceStrValue(GameData.tip["TRANSFER_TO_NAME"], "NAME", _loc_3[7]), "ID", _loc_3[1]);
                    break;
                }
                case 3:
                {
                    _loc_4 = GameData.replaceStrValue(GameData.replaceStrValue(GameData.tip["TRANSFER_FROM_NAME"], "NAME", _loc_3[7]), "ID", _loc_3[1]);
                    break;
                }
                default:
                {
                    break;
                }
            }
            _loc_2.numberId_txt.text = _loc_2.id + "";
            _loc_2.record_txt.htmlText = _loc_4;
            _loc_2.gold_txt.text = _loc_3[2] + " " + GameData.tip["GOLD"];
            _loc_2.time_txt.text = GameData.setDate(_loc_3[5]);
            return;
        }

    }
}
